#include "Log.h"
#include <unistd.h>
int main()
{
    //

    // LogMessage::LogMeg lms(LogLevel::Level::DEBUG, 7, "Main.cpp", "功能测试", "log1");
    // Format::ForMatter Fmater;
    // MyLogBuffer::LogBuffer buffer;
    // for(int i=0;i<1000;i++)
    // {
    //     buffer.push( Fmater.format(lms));
    // }
    // size_t nums=buffer.GetRMesNum();
    // std::cout<<nums<<std::endl;
    // Fmater.format(std::cout,lms);std::shared_ptr<LogLand> LToF = LandFactory<LogToFile, std::string>::CreateLogLand("./log/log1.txt");
    // buffer.print_r();
    // for(int i=0;i<nums;i++)
    // {
    //     LToF->WriteLog(buffer.GetCurRPos().c_str(),buffer.GetCurRPos().length());
    //     buffer.ReadPosOffSet();
    // }
    // buffer.print_r();
    // buffer.print_w();
    //std::shared_ptr<LogLand> LToF = LandFactory<LogToFile, std::string>::CreateLogLand("./Usynclog/log1.txt");
    // // 传入对应的构造函数的参数类型给参数包string,int-->"./Log/log-", 300
    // std::shared_ptr<LogLand> LtoR = LandFactory<LogToRollFile, std::string, int>::CreateLogLand("./UsyncLog/log-", 300);
    // std::shared_ptr<LogLand> LtoStd = LandFactory<LogToStdOut>::CreateLogLand();
    // std::vector<std::shared_ptr<LogLand>> LLd = {
    //     LToF, LtoR, LtoStd};
    // std::shared_ptr<Format::ForMatter> Fmater = std::make_shared<Format::ForMatter>();
    // std::shared_ptr<MyLogger::Logger> LogPtr = std::make_shared<SynLogger>("Log1", LogLevel::Level::INFO, Fmater, LLd);
    std::unique_ptr<MyLogger::LoggerBuilder> Buile = std::make_unique<MyLogger::BuildLocalLogger>("Log1");

    Buile->BuildLoggerType(MyLogger::LoggerType::LOGGER_USYNC);
    Buile->BuiltLogLand<LogToFile>("./Usynclog/log1.txt");

    std::shared_ptr<MyLogger::Logger> LogPtr = Buile->Build();
    MyLogger::LoggerManager::GerInsrance().AddLogger(LogPtr);
    for (int i = 0; i < 1000000; i++)
    {
        //预处理阶段会把Fatal("%s%d", "测试功能1", 777);
        //替换成Fatal(__FILE__, __LINE__, "%s%d", "测试功能1", 777);
        //宏函数加文本替换，编译阶段再做语法检查，
        //  LogPtr->Fatal("%s%d", "测试功能1", 777);
        //LogPtr->Infor(__FILE__, __LINE__, "%s%d", "测试功能2", 777);
        //FATAL("%s%d", "测试功能1", 777);
    }
 
}